-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid NPE in simplify #15310
Avoid NPE in simplify #15310
Conversation
Fixes scala#15272 There's no crash anymore, but scala#15272 still does not compile.
It's a bit troubling that this NPE occurred even with explicit null checking. I believe the root of the matter is that |
It seems the correct type for I think the correct to create Array is:
But it's hard to do these without changing the standard library |
The solution we had in mind way back when @abeln was working on explicit nulls was the following. I was sure we wrote it down somewhere but now I cannot find it:
In this case, line 274 of OrderingConstraint.scala does: val entries1 = new Array[Type](nparams * 2) This uses the to-be-deprecated point 4. We can't do the deprecation without changing the standard library, but perhaps we could already implement 2. in Dotty itself, and modify existing code to avoid the to-be-deprecated point 4., to see how the resulting code looks. Specifically in this case, |
Looking at this again, it's not clear to me whether the If the former, its type should be |
The |
OK. In that case, if we wanted to be safe here, we could make an opaque type for the ParamBounds arrays that returns non-nulls from the first half and nullable typeVars from the second half. But I looked into doing that and I don't think it's worth the complexity: in particular, it would mess up the So I think we should just merge this as is. |
Fixes #15272
There's no crash anymore, but #15272 still does not compile.